﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace Starfox.GameStates
{
   public class Level_01 : EstadoBase
    {
        #region Atributos

        Sky skyDome;

        GameObject3D ponte;

        BasicCamera cam;

        #region Chão

        BasicPrimitive ground;
        BasicPrimitive ground1;
        BasicPrimitive ground2;
        #endregion

        #endregion

        public Level_01(GraphicsDeviceManager graphics, ContentManager Content, Game game, BasicCamera camera)
            :base(graphics, Content, game, camera)
        {
            skyDome = new Sky(game, camera);
            skyDome.CreateSky(32, 32);

            ponte = new GameObject3D();
            ponte.Model = Content.Load<Model>("Bridge");
    
            cam = camera;

            #region Carregando_chão

            ground = new BasicPrimitive(graphics.GraphicsDevice, Content.Load<Texture2D>("Textures/grass"), Color.White);
            ground.World = Matrix.CreateScale(200,300,0) * Matrix.CreateRotationX(MathHelper.ToRadians(-90)) * Matrix.CreateTranslation(0,-10, 0);

            ground1 = new BasicPrimitive(graphics.GraphicsDevice, Content.Load<Texture2D>("Textures/grass"), Color.White);
            ground1.World = Matrix.CreateScale(200, 300, 0) * Matrix.CreateRotationX(MathHelper.ToRadians(-90)) * Matrix.CreateTranslation(0, -10, -300);

            ground2 = new BasicPrimitive(graphics.GraphicsDevice, Content.Load<Texture2D>("Textures/grass"), Color.White);
            ground2.World = Matrix.CreateScale(200, 500, 0) * Matrix.CreateRotationX(MathHelper.ToRadians(-90)) * Matrix.CreateTranslation(0, -10, -710);

            #endregion
           
            ponte.World = Matrix.CreateRotationX(0.1f) * Matrix.CreateTranslation(new Vector3(-3, 100, -3))* Matrix.CreateScale(20f);
           
           
        }

        public override void Update(GameTime gameTime)
        {
            skyDome.Update(gameTime);

           
            
        }

        public override void Draw(GameTime gameTime, BasicCamera camera)
        {
            ponte.Desenhar(cam);

             skyDome.Draw(gameTime);
                     
            #region Desenhando_o_chão_da_fase

            ground.Draw(gameTime,camera);
            ground1.Draw(gameTime, camera);
            ground2.Draw(gameTime, camera);
            #endregion
        }
    }
}
